<template>
  <div class="classroomMamage">
      <div class="top-part">
        <div class="top-tip">{{top_tip}}</div>
        <div class="top-nav">
          <div :class="nav_index === 0?'nav-item active':'nav-item'" @click="navClick(0)">当月账单</div>
          <div :class="nav_index === 1?'nav-item active':'nav-item'" @click="navClick(1)">计费标准</div>
        </div>
      </div>
      <div v-if="nav_index === 0">
        <div class="search_wrap">
          <label class="search_label" style="margin-right:20px">查询时间:</label>
              <el-date-picker
                  v-model="month"
                  type="month"
                  placeholder="选择月分">
              </el-date-picker>
              <el-button type="primary" plain icon="el-icon-search">搜索</el-button>
              <el-button style="float:right" plain type="primary">查看明细</el-button>
        </div>
        <div class="search_wrap">
            <el-row>
                <el-col :span="6">客户名称：neo教育</el-col>
                <el-col :span="6">客户名称：neo教育当月消费：0</el-col>
                <el-col :span="6">当月充值：</el-col>
                <el-col :span="6">计费模式： 计时</el-col>
            </el-row> 
        </div>
      </div>
      <div class="table_list">
        <el-table
          ref="nicheTable"
          :data="tableListData"
          min-height="500"
          border
          v-loading="loading"
          style="width: 100%;margin-top:20px"
        >
          <el-table-column
            v-for="(item,index) in tableCaption1"
            :key="index"
            :label="item.label"
            align="center"
          >
            <template slot-scope="scope">
              <span>{{ scope.row[item.value]}}</span>
            </template>
          </el-table-column>
        </el-table>
        <div>
            
        </div>
      </div>
  </div>
</template>
<script>
import statisticsTag from "@/components/statisticsTag";
import { paginationMixin } from "@/mixin";
import http from "@/api/room";
import { formatDate, formatArray } from "@/utils";
export default {
  name: "finance",
  mixins: [paginationMixin],
  components: {
    statisticsTag
  },
  data() {
    return {
      http: http,
      month:'',
      nav_index: 0,
      top_tip: "当月账单",
      topNavTextList:['当月账单','计费标准'],
      tableListData: [],
      loading: false, //加载状态
      tableCaption1: [
        {
          label: "教室类型",
          value: "classroomNumber",
          width: 100
        },
        {
          label: "总时长",
          value: "classroomName",
          width: 200
        },
        {
          label: "单价",
          value: "classroomName",
          width: 200
        },
        {
          label: "消费总计",
          value: "classroomName",
          width: 200
        }
      ],
    };
  },
  methods: {
    //路由跳转
    goToURL(name, params) {
      this.$router.push({ name, params });
    },
    searchStatus(status) {
      this.status = status;
      this.getListData();
    },
    //导航点击
    navClick(index){
      console.log(index)
      this.nav_index = index;
      this.top_tip = this.topNavTextList[index]
    },
    goToURL(name, query) {
      this.$router.push({ name, query });
    },
    queryListData() {
      this.getListData();
    },
    getListData(
      page = this.currentPage,
      list_rows = this.limit,
      search = this.searchCondition,
      status = this.status
    ) {
      this.loading = true;
      let params = { page, list_rows, search, status };
      let basicConfig = JSON.parse(sessionStorage.getItem("basicConfig"));
      http.getList(params).then(res => {
        this.loading = false;
        this.total = res.data.total;
        let tableListData = res.data.data;
        this.tableListData = tableListData;
      });
    },
    init() {
      this.getListData();
    },
  },
  created() {
    //this.init();
  }
};
</script>
<style lang="scss" scoped>
.classroomMamage {
  padding:10px 20px; 
  .top-part{
    padding-top: 20px;
    .top-tip {
      color: #2f9ceb;
      font-size: 24px;
      display: block;
      height: 30px;
      line-height: 30px;
      padding-left: 15px;
      border-left: 2px solid #2f9ceb;
      margin-bottom: 20px;
    }
    .top-nav {
      display: inline-block;
      border: 1px solid #2f9ceb;
      border-radius: 4px;
      .nav-item{
        float: left;
        padding: 5px 10px;
        margin-left: 0;
        cursor:pointer;
      }
      .nav-item:nth-child(2),
      .nav-item:nth-child(3) {
        border-left: 1px solid #2f9ceb;
      }
      .active {
        background: #2f9ceb;
        color: #fff;
      }
    }
  }
  .search_wrap{
    background: #fff;
    padding: 20px;
  }
  .opt_wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 34px;
    &_left {
      display: flex;
      p {
        margin-right: 18px;
        color: #565656;
        font-size: 16px;
        cursor: pointer;
        &:hover {
          color: #1796eb;
        }
        &:nth-of-type(1) {
          cursor: default;
          color: #646464;
          &:hover {
            color: #646464;
          }
        }
      }
    }
    &_right {
      display: flex;
      align-items: center;
      p {
        margin-left: 18px;
        color: #565656;
        font-size: 16px;
        cursor: pointer;
        &:hover {
          color: #1796eb;
        }
      }
      .add {
        width: 72px;
        height: 30px;
        background: linear-gradient(top left, #17b5eb, #1796eb);
        display: flex;
        justify-content: center;
        align-items: center;
        color: white;
        cursor: pointer;
        border-radius: 5px;
        &:hover {
          color: white;
        }
      }
    }
  }
  .search_wrap {
    margin-top: 34px;
    margin-bottom: 34px;
  }
  .see_detail {
    cursor: pointer;
    color: #1796eb;
  }
  .btn {
    margin-top: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    /deep/ .el-button {
      width: 214px;
    }
  }
  .del_modal {
    .content {
      display: flex;
      flex-direction: column;
      align-items: center;
      p {
        &:nth-of-type(1) {
          width: 92px;
          height: 92px;
          border-radius: 50%;
          background: linear-gradient(to bottom, #f25851, #f27350);
          display: flex;
          justify-content: center;
          align-items: center;
          margin-bottom: 18px;
          i {
            font-size: 40px;
            color: white;
          }
        }
        &:nth-of-type(2) {
          font-size: 20px;
          color: #333;
        }
        &:nth-of-type(3) {
          font-size: 14px;
          color: #999;
          margin-top: 7px;
        }
      }
    }
  }
  .operation {
    cursor: pointer;
    color: rgb(47, 156, 235);
  }
}
.el-table .success-row {
  background: #f0f9eb;
}
</style>